<?php
namespace app\api\service;
use think\Request;
use app\api\model\Position;

class PositionService {
    public function page($page = 1, $size = 10){
        $data 	= Request::instance()->get();
        $where 	= [];

        empty($data['name']) || $where['name'] = ['like','%'.$data['name']];

        $obj = Position::where($where)
        ->paginate($size, false, ['page' => $page]);

        if ($obj->isEmpty()){
            return [];
        }
        return $obj->toArray();
    }
}